package com.piece.core.framework.util.string;

import org.jsoup.Jsoup;
import org.jsoup.safety.Whitelist;
import org.pegdown.Extensions;
import org.pegdown.PegDownProcessor;

/**
 * Markdown转换工具
 */
public class MarkdownUtil {

    public static String generateHtml(String markdownStr) {
        PegDownProcessor pdp = new PegDownProcessor(Extensions.ALL_WITH_OPTIONALS);
        String htmlContent = pdp.markdownToHtml(markdownStr);
        return Jsoup.clean(htmlContent, Whitelist.relaxed());
    }
}